#include <iostream>
#include <cmath>

using namespace std;

int lcm, gcd;
int ntest;

int main()
{
	cin >> ntest;
	while (ntest--)
	{
		cin >> gcd >> lcm;
		if (lcm % gcd == 0) cout << gcd << " " << lcm << endl;
		else cout << -1 << endl;
	}
	return 0;
}
